﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
checkadmin(1)
dim content,id,rsa,sqla,replytime,rsb,sqlb
Dim sendmail,tomail,title,commentcontent
tomail=Trim(request.Form("tomail"))
title=Trim(request.Form("title"))
commentcontent=Trim(request.Form("commentcontent"))
sendmail=Trim(request.Form("sendmail"))
If IsNull(sendmail) Or sendmail="" Then sendmail=0


content=HTMLEncode(request.Form("content"))
If (content="") Then
historygoback("请填写回复内容")
End If 
id=HTMLEncode(request.Form("id"))
Set rsa = Server.CreateObject("ADODB.Recordset")
sqla = "select * from [c_record_reply]"
rsa.open sqla,conn,1,3
rsa.addnew
rsa("commentid")=CInt(id)
rsa("replyauthor")=session("user_name")
rsa("content")=content
rsa("replytime")=Now()
rsa.update
replytime=rsa("replytime")
rsa.close

Set rsb = Server.CreateObject("ADODB.Recordset")
sqlb = "select * from [c_record_comment] where id="&id
rsb.open sqlb,conn,1,3
If Not rsb.eof Then 
rsb("replytime")=replytime
rsb("visible")=1
End If 
rsb.update
rsb.close

If sendmail="1" Then
Dim emailcontent
If lang=1 Then 
emailcontent="<h1>Title:"&title&"</h1>"
emailcontent=emailcontent&"Your Comment:<br/>"
emailcontent=emailcontent&commentcontent&"<br/>"
emailcontent=emailcontent&"<hr/>"
emailcontent=emailcontent&"Reply Time:"&Now()&"<br/>"
emailcontent=emailcontent&"Reply Content:<br/>"
emailcontent=emailcontent&content
Call SendEmailToUser(tomail,"New Reply:"&title,emailcontent)
Else 
emailcontent="<h1>评论标题："&title&"</h1>"
emailcontent=emailcontent&"评论内容：<br/>"
emailcontent=emailcontent&commentcontent&"<br/>"
emailcontent=emailcontent&"<hr/>"
emailcontent=emailcontent&"回复时间:"&Now()&"<br/>"
emailcontent=emailcontent&"回复内容：<br/>"
emailcontent=emailcontent&content
Call SendEmailToUser(tomail,"您的评论有回复啦："&title,emailcontent)
End If 
End If
response.redirect("recordcomment_list.asp")
%>